{% extends "pages/body.html" %}
{% load i18n %}
{% load cbc %}
{% load fbc %}
{% block header %}{{ page.title }}{% endblock %}
{% block title %}{{ page.title }}{% endblock %}
{% block description %}{{ page.title }}{% endblock %}
{% block meta %}{% if add_topic %}<link rel="stylesheet" href="/site_media/layout/forum.css" type="text/css" />{% endif %}{% endblock %}
{% block crumb %}<a href="/">{% trans "Home" %}</a>{% if page.crumb %} > {{ page.crumb|safe }}{% endif %}{% endblock %}

{% block content %}
{{ page.description|cbc|safe }}
{{ page.text|cbc|safe }}
<ul class="newsbox">
	<li><b>{% trans "Added" %}</b>: {{ page.date|date:"d.m.Y" }} {% trans "by" %} {{ page.author }}</li>
	{% if add_topic %}<li>
		{% if page.coment_topic %}
			<a href="/forum/topic/1/{{ page.coment_topic.id }}/"><b>{% trans "Read comments" %}</b>{% if page.comments_count %} ({{ page.comments_count }}){% endif %}</a>
		{% else %}
			<a href="?c=ok#c"><b>{% trans "Comments" %}</b>{% if page.comments_count %} ({{ page.comments_count }}){% endif %}</a>
		{% endif %}
	</li>{% endif %}
	{% if page.is_update %}<li><b>{% trans "Update" %}</b>: {{ page.changes }}</li>{% endif %}
</ul>
{% if add_topic %}
	{% if show_comment %}
	{% if comments %}
		<div id="feed">
		{% for i in comments %}
		{% if not i.is_injected_post %}
		<dl>
			<dt><b>{% if i.author_anonymous %}~<i>{% endif %}{{ i.author}}{% if i.author_anonymous %}</i>{% endif %}</b></dt>
			<dd>
			<ul>
				<li>
				{{ i.text|fbc|safe|urlizetrunc:"60" }}
				</li>
				<li class="post2">{{ i.date|date:"Y.m.d G:i" }}{% if user.is_staff %} | {{ i.ip }}{% endif %}</li>
			</ul>
			</dd>
		</dl>
		{% endif %}
		{% endfor %}
		</div>
	{% endif %}

	<form method="post" action=".">
	<div class="postform">
		<div class="posthead">{% trans "Add comment" %}</div>
		{% if not user.is_authenticated %}
			<div class="leftpostform">
				<strong>{% trans "Nick" %}</strong>
			</div>
			<div class="rightpostform">
				{{ form.nick }}{% if form.nick.errors %}<br />*** {{ form.nick.errors|join:", " }}{% endif %}
			</div>
		{% endif %}
		<div class="leftpostform">
			<strong>{% trans "Comment" %}</strong>
		</div>
		<div class="rightpostform">
			<a name="c"></a>
			<textarea name="text" rows="6" cols="60">{{ post_text }}</textarea>
			{% if form.text.errors %}<br />*** {{ form.text.errors|join:", " }}{% endif %}
		</div>
		<div class="leftpostform">
		</div>
		<div class="rightpostform comments">
			<input type="submit" value="{% trans "Add comment" %}" />
			{% if page.coment_topic %}
				<input type="button" value="{% trans "Read all comments" %}" onclick="location.assign('/forum/topic/1/{{ page.coment_topic.id }}/');" />
			{% endif %}
		</div>
	</div>
	</form>
	{% endif %}
{% else %}
	{% if user.is_authenticated %}<div class="box">{% trans "Comments have been disabled for this page" %}</div>{% endif %}
{% endif %}

{% endblock %}
{% block pagemenu %}
{% if add_topic %}<li class="book"><a href="?c=ok#c">{% trans "Comments" %} ({{ page.comments_count }})</a></li>{% endif %}
{% if page.current_book %}
	<li class="book"><a href="/w/n/{{ page.current_book }}/">{% trans "Browse category news" %}</a></li>
	<li class="pagerss"><a href="/w/r/{{ page.current_book }}/">{% trans "Category RSS" %}</a></li>
{% endif %}
{% if user.is_staff %}<li class="book"><a href="/admin/pages/content/{{ page.id }}/">{% trans "Admin" %}</a></li>{% endif %}
{% endblock %}

